package xyj.sparrow.scheduler.cron.ops;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import xyj.sparrow.scheduler.cron.Cron;

import javax.annotation.Resource;
import java.util.List;

/**
 * 默认实现
 *
 * @author 江南小俊
 * @since 2021/6/22
 **/
@Slf4j
@Component
public class DefaultCronOps implements CronOps {

    @Resource
    private MessageSync messageSync;

    @Override
    public void removeByTaskIds(List<String> taskIds) {
        messageSync.removeByTaskIds(taskIds);
    }


    @Override

    public void removeByAppIds(List<String> appIds) {
        messageSync.removeByAppIds(appIds);
    }

    @Override
    public void addCron(Cron cron) {
        messageSync.addCron(cron);
    }

    @Override
    public void updateCron(Cron cron) {
        messageSync.updateCron(cron);
    }

    @Override
    public void batchUpdateCronByAppId(List<String> appIds) {
        messageSync.batchUpdateCronByAppId(appIds);
    }

    @Override
    public void batchUpdateCronByTask(List<String> taskIds) {
        messageSync.batchUpdateCronByTaskId(taskIds);
    }

    @Override
    public void runCronByTask(String taskId) {
        messageSync.runCronByTask(taskId);
    }
}
